package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.domain.dao.LSzgx;
import com.ruoyi.service.ILSzgxService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;


import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 【请填写功能名称】Controller
 * 
 * @author zxw
 * @date 2025-07-09
 */
@Api(tags = "业务——市政管线管理")
@RestController
@RequestMapping("/admin/szgx")
public class LSzgxController extends BaseController
{
    @Autowired
    private ILSzgxService lSzgxService;

   /**
    * @auther: zxw
    * @Description //多条件查询市政管线
    * @date: 2025/7/9 上午10:24
    */
    @GetMapping("/list")
    @ApiOperation("多条件查询市政管线")
    public TableDataInfo list(LSzgx lSzgx)
    {
        startPage();
        List<LSzgx> list = lSzgxService.selectLSzgxList(lSzgx);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */

    @ApiOperation("导出")
    @PostMapping("/export")
    public void export(HttpServletResponse response, LSzgx lSzgx)
    {
        List<LSzgx> list = lSzgxService.selectLSzgxList(lSzgx);
        ExcelUtil<LSzgx> util = new ExcelUtil<LSzgx>(LSzgx.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @ApiOperation("按照gid查询")
    @GetMapping(value = "/{gid}")
    public AjaxResult getInfo(@PathVariable("gid") Long gid)
    {
        return success(lSzgxService.selectLSzgxByGid(gid));
    }

    /**
     * 新增【请填写功能名称】
     */
    @ApiOperation("添加")
    @PostMapping
    public AjaxResult add(@RequestBody LSzgx lSzgx)
    {
        return toAjax(lSzgxService.insertLSzgx(lSzgx));
    }

    /**
     * 修改【请填写功能名称】
     */


    @ApiOperation("编辑")
    @PutMapping
    public AjaxResult edit(@RequestBody LSzgx lSzgx)
    {
        return toAjax(lSzgxService.updateLSzgx(lSzgx));
    }

    /**
     * 删除【请填写功能名称】
     */

    @ApiOperation("删除")
	@DeleteMapping("/{gids}")
    public AjaxResult remove(@PathVariable Long[] gids)
    {
        return toAjax(lSzgxService.deleteLSzgxByGids(gids));
    }


    @ApiOperation("市政管线道路唯一值")
    @GetMapping(value = "/roadDistinct")
    public AjaxResult roadDistinct()
    {
        return success(lSzgxService.roadDistinct());
    }
}
